-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REST products update category_ids cannot be removed #20842
REST products update category_ids cannot be removed #20842
Conversation
Hi @ygyryn. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento-engcom-team give me test instance |
Hi @dmytro-ch. Thank you for your request. I'm working on Magento instance for you |
Hi @dmytro-ch, here is your new Magento instance. |
Hi @ygyryn, thank you for your contribution! There are couple of test failures with the current solution in Thank you. |
Code review, updated unit tests
Hi @dmytro-ch, thank you for the review. |
849f1c6
to
96b6feb
Compare
Hi @ygyryn, thank you for your contribution! |
As of Magento 2.3.3, this problem is NOT fixed. Assigning a reduced list of category_ids does not correctly remove remaining category_ids that should no longer be there. |
Fixed issue with not correct updating products category_ids through /rest/ for custom_attribute { 'category_ids } data.
Description (*)
Added call of assignProductToCategories method in \Magento\Catalog\Model\ProductRepository::save
in case when a product currently don't have extension attributes.
This is needed to fix a problem with not correct updating category_ids when try to update the product with /rest/all/V1/products/ through custom_attribute { 'category_ids': '['10127', '10048'] },
Fixed Issues
#20481: REST products update category_ids cannot be removed
Manual testing scenarios (*)
Open in swagger catalogProductRepositoryV1 and call PUT: /V1/products/{sku}
Use test product with such test case:
"custom_attributes": [
{
"attribute_code": "category_ids",
"value": [
"1", "2", "3", "4"
]
}
]
Result will be such: all category_ids with provided id's "1", "2", "3", "4" will be assigned to product.
"custom_attributes": [
{
"attribute_code": "category_ids",
"value": [
"1", "3"
]
}
]
Result will be such: category_ids with provided id's "1", "3" will be assigned to product.
Other category_ids, that where before, will be unassigned from product, as expected.
So now category_ids are updated correct!
Contribution checklist (*)